Ranking Catamorphisms and Unranking Anamorphisms on Hereditarily Finite Datatypes

نویسنده

  • Paul Tarau
چکیده

Using specializations of unfold and fold on a generic tree data type we derive unranking and ranking functions providing natural number encodings for various Hereditarily Finite datatypes. In this context, we interpret unranking operations as instances of a generic anamorphism and ranking operations as instances of the corresponding catamorphism. Starting with Ackerman’s Encoding from Hereditarily Finite Sets to Natural Numbers we define pairings and finite tuple encodings that provide building blocks for a theory of Hereditarily Finite Functions. The more difficult problem of ranking and unranking Hereditarily Finite Permutations is then tackled using Lehmer codes and factoradics. The self-contained source code of the paper, as generated from a literate Haskell program, is available at http:// logic.csci.unt.edu/tarau/research/2008/fFUN.zip.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Ranking and Unranking of Hereditarily Finite Functions and Permutations

Prolog’s ability to return multiple answers on backtracking provides an elegant mechanism to derive reversible encodings of combinatorial objects as Natural Numbers i.e. ranking and unranking functions. Starting from a generalization of Ackerman’s encoding of Hereditarily Finite Sets with Urelements and a novel tupling/untupling operation, we derive encodings for Finite Functions and use them a...

متن کامل

Declarative Combinatorics: Boolean Functions, Circuit Synthesis and BDDs in Haskell

We describe Haskell implementations of interesting combinatorial generation algorithms with focus on boolean functions and logic circuit representations. First, a complete exact combinational logic circuit synthesizer is described as a combination of catamorphisms and anamorphisms. Using pairing and unpairing functions on natural number representations of truth tables, we derive an encoding for...

متن کامل

A Functional Hitchhiker's Guide to Hereditarily Finite Sets, Ackermann Encodings and Pairing Functions

The paper is organized as a self-contained literate Haskell program that implements elements of an executable finite set theory with focus on combinatorial generation and arithmetic encodings. The code, tested under GHC 6.6.1, is available at http://logic.csci.unt.edu/tarau/ research/2008/fSET.zip. We introduce ranking and unranking functions generalizing Ackermann’s encoding to the universe of...

متن کامل

"Everything Is Everything" Revisited: Shapeshifting Data Types with Isomorphisms and Hylomorphisms

This paper is an exploration of isomorphisms between elementary data types (e.g., natural numbers, sets, finite functions, graphs, hypergraphs) and their extension to hereditarily finite universes through hylomorphisms derived from ranking/unranking and pairing/unpairing operations. An embedded higher order combinator language provides any-toany encodings automatically. A few examples of free a...

متن کامل

Primitive (Co)Recursion and Course-of-Value (Co)Iteration, Categorically

In the mainstream categorical approach to typed (total) functional programming, datatypes are modelled as initial algebras and codatatypes as terminal coalgebras. The basic function definition schemes of iteration and coiteration are modelled by constructions known as catamorphisms and anamorphisms. Primitive recursion has been captured by a construction called paramorphisms. We draw attention ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:
  • CoRR

دوره abs/0808.0753  شماره 

صفحات  -

تاریخ انتشار 2008